﻿namespace IceCS.DataStructure.Core.String
{
    /// <summary>
    /// 串接口
    /// </summary>
    public interface IString<T>
    {
        /// <summary>
        /// 串比较
        /// </summary>
        /// <param name="s"></param>
        /// <returns></returns>
        int Compare(T s);

        /// <summary>
        /// 获得子串
        /// </summary>
        /// <param name="start"></param>
        /// <param name="length"></param>
        /// <returns></returns>
        T SubString(int start, int length);

        /// <summary>
        /// 串连接
        /// </summary>
        /// <param name="s"></param>
        /// <returns></returns>
        T Concat(T s);

        /// <summary>
        /// 子串首次出现索引
        /// </summary>
        /// <param name="s"></param>
        /// <returns></returns>
        int IndexOf(T s, int startpos);

        /// <summary>
        /// 子串最后出现的索引
        /// </summary>
        /// <param name="s"></param>
        /// <returns></returns>
        int LastIndexOf(T s);

        /// <summary>
        /// 串插入
        /// </summary>
        /// <param name="index"></param>
        /// <param name="s"></param>
        /// <returns></returns>
        T Insert(int index, T s);

        /// <summary>
        /// 串删除
        /// </summary>
        /// <param name="index"></param>
        /// <param name="len"></param>
        /// <returns></returns>
        T Delete(int index, int len);

        /// <summary>
        /// 串长度
        /// </summary>
        int Length { get; }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        T this[int index] { get; set; }
    }
}
